package com.rc.saas.mini.service.rc;

import com.rc.saas.mini.mapper.rc.RcMemberGainGradeSettingMapper;
import com.rc.saas.mini.model.rc.RcMemberGainGradeSetting;
import com.rc.saas.mini.model.rc.RcMemberGainGradeSettingExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RcMemberGainGradeSettingServiceImpl implements RcMemberGainGradeSettingService {
    @Autowired
    private RcMemberGainGradeSettingMapper rcMemberGainGradeSettingMapper;

    @Override
    public RcMemberGainGradeSettingMapper getMapper() {
        return rcMemberGainGradeSettingMapper;
    }

    @Override
    public List<RcMemberGainGradeSetting> listByAll() {
        //2022.08.09
        RcMemberGainGradeSettingExample example = new RcMemberGainGradeSettingExample();
        example.setOrderByClause("recharge_amount");
        return rcMemberGainGradeSettingMapper.selectByExample(example);

    }

    @Override
    public List<RcMemberGainGradeSetting> listByWithMemberGainIds(List<Long> ids) {
        RcMemberGainGradeSettingExample example = new RcMemberGainGradeSettingExample();
        example.createCriteria().andMemberGainIdIn(ids);
        example.setOrderByClause("member_gain_id asc,created_time desc");
        return rcMemberGainGradeSettingMapper.selectByExample(example);
    }

    @Override
    public List<RcMemberGainGradeSetting> listByMemberGainId(Long memberGainId) {
        RcMemberGainGradeSettingExample example = new RcMemberGainGradeSettingExample();
        example.createCriteria().andMemberGainIdEqualTo(memberGainId);
        example.setOrderByClause("member_gain_id asc,created_time desc");
        return rcMemberGainGradeSettingMapper.selectByExample(example);
    }
}
